🔒 fix potential panic when match finder is missing#425
Conversation
Replaced unsafe .unwrap() calls on self.mf.take() with safe checks that return a new InternalError variant. This prevents a potential Denial of Service (DoS) panic if the match finder is unexpectedly None, for example, due to a previous panic poisoning the Compressor state. Updated the return signature of Compressor::compress_to_size to support error propagation.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
🎯 What: Fixed potential panics in
⚠️ Risk: A Denial of Service (DoS) vulnerability where an attacker could trigger a crash if they can induce a state where the match finder is
Compressor::compressandCompressor::compress_to_sizecaused by calling.unwrap()on a missing match finder.None(e.g., by reusing aCompressorinstance after a previous operation panicked).🛡️ Solution: Introduced a
CompressResult::InternalErrorvariant and replaced.unwrap()with safe pattern matching. Updated the public API to propagate these errors asstd::io::Error. Added a regression testtest_compressor_missing_mf.PR created automatically by Jules for task 17842979915340093213 started by @404Setup